package designmodel.builder.经典建造者模式.练习案例;

/**
 * SunnyVideo制造者1
 *
 * @author scylla
 * @version V1.0
 * @project echo-java-base
 * @title
 * @package designmodel.builder.经典建造者模式.练习案例
 * @since 2021/12/16 10:52 上午
 */
public class SVDirector {


    private SVBuilder getBuilder(String mode) {
        SVBuilder builder = null;
        switch (mode) {
            case "all":
                builder = new ConcretCompletedBuilder("主窗口", "控制条");
                break;
            case "mini":
                builder = new ConcretMiniBuilder("主窗口", "控制条");
                break;
            case "mem":
                builder = new ConcretMemBuilder("主窗口", "控制条");
                break;
            default:
                break;
        }
        return builder;
    }

    private void makePlayer(SVBuilder builder) {
        builder.loadMenu().loadVlist().loadClist();
    }



    public static void main(String[] args) {
        SVDirector director = new SVDirector();

        SVBuilder allBuilder = director.getBuilder("all");
        SVBuilder miniBuilder = director.getBuilder("mini");
        SVBuilder memBuilder = director.getBuilder("mem");


        director.makePlayer(allBuilder);
        director.makePlayer(miniBuilder);
        director.makePlayer(memBuilder);

        SunnyVideoPlayer allPlayer = allBuilder.getPlayer();
        SunnyVideoPlayer miniPlayer = miniBuilder.getPlayer();
        SunnyVideoPlayer memPlayer = memBuilder.getPlayer();

        System.out.println(allPlayer);
        System.out.println(miniPlayer);
        System.out.println(memPlayer);


    }

}
